package controller;

import dao.EquipMsgDao;
import dao.ProductMsgDao;
import pojo.equip.EquipMsgEntity;
import pojo.product.ProductMsgEntity;

import java.io.IOException;

/**
 * @author Limohan
 */
public class EquipMsgController {
    private final EquipMsgDao equipMsgDao = new EquipMsgDao();
    private static final EquipMsgController equipMsgController = new EquipMsgController();
    private EquipMsgController(){}

    public static EquipMsgController getInstance(){
        return equipMsgController;
    }

    //新增
    public String addMsg(EquipMsgEntity equipMsgEntity) throws IOException {
        equipMsgEntity.setId("1");
        String id =equipMsgDao.getMaxId();
        equipMsgEntity.setId(id);
        if(equipMsgDao.isEquip(equipMsgEntity.getType())){
            equipMsgDao.saveMsg(equipMsgEntity);
            return "添加成功";
        }
        return "没有此类型";
    }
}
